﻿#region 命名空间

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;
using WinnerCMS.BLL;
using WinnerCMS.Common;
using WinnerCMS.Model;

#endregion

namespace WinnerCMS.WebUI.Admin.Controllers
{
    public class CategoryController : ApiController
    {
        public IEnumerable<WinnerCMS.Model.Category> Children(int parentId)
        {
            return CategoryManage.GetChildren(parentId);
        }

        [HttpPost]
        public IList<TreeNode> TreeList()
        {
            int id;
            int.TryParse(HttpContext.Current.Request["id"], out id);

            return new CategoryManage().CategoryTreeList(id);
        }

        [HttpPost]
        public void OrderByMove(WinnerCMS.Model.Category model)
        {
            new CategoryManage().OrderByMove(model);
        }

        [HttpPost]
        public Result Delete(int id)
        {
            return new CategoryManage().Delete(id);
        }

        [HttpPost]
        public void Clear(int id)
        {
            new CategoryManage().Clear(id);
        }
    }
}